package com.yunxi.module.infra.api.file;

import com.yunxi.framework.common.pojo.CommonResult;
import com.yunxi.module.infra.dto.file.FileCreateReqDTO;
import com.yunxi.module.infra.service.file.FileService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 提供 RESTful API 接口，给 Feign 调用
 * </p>
 *
 * @author lidy
 * @since 2024-05-24
 */
@RestController
@Validated
public class FileApiImpl implements FileApi {

    @Resource
    private FileService fileService;

    @Override
    public CommonResult<String> createFile(FileCreateReqDTO fileCreateReqDTO) {
        return CommonResult.success(fileService.createFile(fileCreateReqDTO.getName(),
                fileCreateReqDTO.getPath(), fileCreateReqDTO.getContent()));
    }
}
